import {
  q as l,
  ap as ne,
  X as S,
  f as se,
  H as le,
  av as z,
  aw as ue,
  k as t,
  m as a,
  ax as x,
  l as n,
  as as o,
  at as U,
  ay as ie
} from "./index-b50e6ef9.js";
import { g as re, h as H, a as k, i as oe } from "./activity-9dc68ac4.js";
function ce(g) {
  return (
    typeof g == "function" ||
    (Object.prototype.toString.call(g) === "[object Object]" && !ie(g))
  );
}
function ge(g) {
  const F = l([]),
    c = l(!0),
    Y = l(),
    B = l(1),
    D = l(10),
    m = l(1),
    h = l(10),
    w = l(),
    E = l([]),
    A = l(),
    I = l(""),
    v = l(),
    y = l(),
    N = l(),
    O = ne("reload"),
    W = S({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [10, 20, 30],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    _ = S({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [5, 10, 20],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    j = S({
      text: "正在加载第一页...",
      viewBox: "-10, -10, 50, 50",
      spinner: `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `
    }),
    L = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "id", minWidth: 80 },
      { label: "活动名称", prop: "meeting_name", minWidth: 120 },
      { label: "发起人", prop: "user_name", minWidth: 80 },
      { label: "活动地址", prop: "meeting_add", minWidth: 150 },
      {
        label: "报名费用",
        prop: "meeting_money,meeting_value",
        minWidth: 80,
        formatter: ({ meeting_money: e, meeting_value: s }) =>
          (Number(e) + Number(s)).toFixed(2)
      },
      { label: "奖励云值", prop: "meeting_reward", minWidth: 80 },
      { label: "活动人数", prop: "meeting_count", minWidth: 80 },
      {
        label: "开始/结束",
        prop: "meeting_start,meeting_over",
        minWidth: 200,
        formatter: ({ meeting_start: e, meeting_over: s }) =>
          t("div", null, [
            " ",
            t("span", null, [
              a("开始："),
              x.unix(e).format("YYYY-MM-DD HH:mm:ss")
            ]),
            t("br", null, null),
            t("span", null, [
              a("结束："),
              x.unix(s).format("YYYY-MM-DD HH:mm:ss")
            ])
          ])
      },
      {
        label: "报名/取消",
        prop: "meeting_stop,meeting_remove",
        minWidth: 200,
        formatter: ({ meeting_stop: e, meeting_remove: s }) =>
          t("div", null, [
            " ",
            t("span", null, [
              a("报名："),
              x.unix(e).format("YYYY-MM-DD HH:mm:ss")
            ]),
            t("br", null, null),
            t("span", null, [
              a("取消："),
              x.unix(s).format("YYYY-MM-DD HH:mm:ss")
            ])
          ])
      },
      {
        label: "活动图片",
        prop: "meeting_img",
        minWidth: 100,
        cellRenderer: e =>
          t("div", null, [
            " ",
            t(
              "img",
              {
                src: e.row.meeting_img,
                style: "width: 100%; height: 100%;",
                alt: ""
              },
              null
            )
          ])
      },
      {
        label: "创建/修改",
        prop: "create_time,update_time",
        minWidth: 200,
        formatter: ({ create_time: e, update_time: s }) =>
          t("div", null, [
            " ",
            t("span", null, [a("创建："), e]),
            t("br", null, null),
            t("span", null, [a("修改："), s || "暂无修改"])
          ])
      },
      { label: "操作", fixed: "right", width: 200, slot: "operation" }
    ],
    T = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "id", fixed: "left", minWidth: 60 },
      { label: "姓名", prop: "user_name", minWidth: 120 },
      { label: "手机号", prop: "user_phone", minWidth: 120 },
      {
        label: "等级",
        prop: "user_vip",
        minWidth: 80,
        formatter: ({ user_vip: e }) => {
          if (e == 1)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("VIP")] }
            );
          if (e == 0)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "info", effect: "light" },
              { default: () => [a("会员")] }
            );
        }
      },
      {
        label: "身份",
        prop: "user_place",
        minWidth: 80,
        formatter: ({ user_place: e }) => {
          if (e == 0)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("暂无")] }
            );
          if (e == 1)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("一星合伙人")] }
            );
          if (e == 2)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("二星合伙人")] }
            );
          if (e == 3)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("三星合伙人")] }
            );
          if (e == 4)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("四星合伙人")] }
            );
          if (e == 5)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("五星合伙人")] }
            );
          if (e == 6)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("一星联创")] }
            );
          if (e == 7)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("二星联创")] }
            );
          if (e == 8)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("三星联创")] }
            );
          if (e == 9)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("四星联创")] }
            );
          if (e == 10)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("一星董事")] }
            );
          if (e == 11)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("二星董事")] }
            );
          if (e == 12)
            return t(
              n("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [a("三星董事")] }
            );
        }
      },
      {
        label: "状态",
        prop: "check",
        minWidth: 100,
        formatter: ({ check: e }) =>
          e == 1
            ? t(
                n("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => [a("已到场")] }
              )
            : e == 2
            ? t(
                n("el-tag"),
                { class: "mx-1", type: "danger", effect: "light" },
                { default: () => [a("未到场")] }
              )
            : e == 3
            ? t(
                n("el-tag"),
                { class: "mx-1", type: "warning", effect: "light" },
                { default: () => [a("已取消")] }
              )
            : t(
                n("el-tag"),
                { class: "mx-1", type: "info", effect: "light" },
                { default: () => [a("已报名")] }
              )
      },
      {
        label: "座位",
        prop: "seat",
        minWidth: 120,
        formatter: ({ seat: e }) =>
          e
            ? t(
                n("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                ce(e) ? e : { default: () => [e] }
              )
            : t(
                n("el-tag"),
                { class: "mx-1", type: "danger", effect: "light" },
                { default: () => [a("未分配")] }
              )
      },
      { label: "操作", fixed: "right", width: 200, slot: "operationUser" },
      { label: "座位", fixed: "right", width: 100, slot: "operationUserZw" },
      { label: "打印", fixed: "right", width: 100, slot: "operationDy" }
    ],
    R = se(() => [
      "!h-[20px]",
      "reset-margin",
      "!text-gray-500",
      "dark:!text-white",
      "dark:hover:!text-primary"
    ]);
  async function q(e) {
    const s = { id: e.id },
      i = JSON.stringify(s),
      d = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(i)) },
      u = await re(d);
    u.code == 200
      ? (U("删除成功", { type: "success" }), O())
      : U(u.msg, { type: "error" });
  }
  function P() {}
  function X(e) {
    (D.value = e), C(void 0, e);
  }
  function Z(e) {
    (B.value = e), C(e, void 0);
  }
  function $(e) {
    (m.value = e), J(e, void 0);
  }
  function G(e) {
    (h.value = e), J(void 0, e);
  }
  function K(e) {}
  function Q(e) {
    (j.text = `正在加载第${e}页...`),
      (c.value = !0),
      z(600).then(() => {
        c.value = !1;
      });
  }
  async function ee(e) {
    c.value = !0;
    const s = { page: B.value, pagesize: D.value, meeting_name: e },
      i = JSON.stringify(s),
      d = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(i)) },
      { data: u } = await H(d);
    (F.value = u.data),
      (W.total = u.total),
      setTimeout(() => {
        c.value = !1;
      }, 500);
  }
  async function M(e, s, i, f) {
    (w.value = s), (c.value = !0);
    const d = {
        page: m.value,
        pagesize: h.value,
        check: s,
        user_phone: isNaN(e) ? void 0 : e,
        user_name: isNaN(e) ? e : void 0,
        id: A.value,
        user_vip: i,
        user_place: f
      },
      u = JSON.stringify(d),
      b = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(u)) },
      { data: p } = await k(b);
    (_.total = p.users.total),
      (E.value = p.users.data),
      setTimeout(() => {
        c.value = !1;
      }, 500);
  }
  async function C(e = B.value, s = D.value) {
    const i = { page: e, pagesize: s, user_vip: v.value, user_place: y.value },
      f = JSON.stringify(i),
      u = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(f)) },
      r = await H(u);
    if (r.code === 200) {
      const b = await oe();
      b.forEach(p => {
        r.data.data.forEach(V => {
          p.user_id == V.user_id && (V.user_name = p.user_name);
        });
      }),
        (Y.value = b),
        (F.value = r.data.data),
        (W.total = r.data.total),
        setTimeout(() => {
          c.value = !1;
        }, 500);
    } else U(r.msg, { type: "error" });
  }
  const J = async (e = m.value, s = h.value) => {
      const i = {
          page: e,
          pagesize: s,
          id: A.value,
          check: w.value,
          user_vip: v.value,
          user_place: y.value
        },
        f = JSON.stringify(i),
        u = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(f)) },
        r = await k(u);
      r.code === 200 &&
        ((_.total = r.data.users.total), (E.value = r.data.users.data));
    },
    te = e => {
      e && (e.resetFields(), location.reload());
    },
    ae = async e => {
      e &&
        (e.resetFields(),
        (N.value = ""),
        (v.value = ""),
        (y.value = ""),
        M(void 0, void 0, void 0, void 0),
        (I.value = ""));
    };
  return (
    le(() => {
      z().then(() => {
        const { setWatermark: e } = ue(g.value.getTableDoms().tableWrapper);
        e("后台项目", {
          font: "16px Microsoft YaHei",
          globalAlpha: 0.8,
          forever: !0,
          width: 252,
          height: 80
        });
      }),
        C();
    }),
    {
      loading: c,
      columns: L,
      dataList: F,
      pagination: W,
      buttonClass: R,
      userlist: Y,
      check: w,
      columsUser: T,
      userInfo: E,
      paginationUser: _,
      meetingId: A,
      userPhone: I,
      valueType: N,
      vipVlaue: v,
      gradeVip: y,
      countUser: m,
      pageCountUser: h,
      onSearchUser: M,
      onSearch: ee,
      resetForm: te,
      handleaddUser: P,
      handleDelete: q,
      handleSizeChange: X,
      handleCurrentChange: Z,
      handleSelectionChange: K,
      handleUserCurrentChange: $,
      handleUserSizeChange: G,
      onCurrentChange: Q,
      resetFormUser: ae
    }
  );
}
export { ge as useRole };
